import { REG } from "@/data/locations";
import { PageLifeProbeRequire } from "@/data/settings";
import { StyleMgr } from "../libs/core/styleOperation";
import style from "./styles/topNavBlur.scss";

const entry = (): boolean => {
  console.log(style);
  return StyleMgr.add(
    "navbarBlur",
    `
  #header {
    background-color: #f8f8f896;
    backdrop-filter: blur(1.2vw);
  }
  #header.fixed > div {
    background: #fff0;
    backdrop-filter: blur(1.2vw);
  }
  
  #pagelet_newheader > [data-c-w-header] {
    background: #ffffff24;
  }
  
  #header.fixed > div.clearfix > #nav .wp {
    background: #ffffff24;
  }
  
  #header.fixed > div.clearfix > #nav {
    background: #ffffff24;
  }  
  `
  );
  // return StyleMgr.add("navbarBlur", style);
};

const module: ModulesConstructure = {
  name: "navbarBlur",
  start: entry,
  type: "style",
  condition: {
    siteMatch: [
      REG.index,
      REG.videoAndBangumi,
      REG.article,
      REG.userHome,
      REG.partIndex,
    ],
    pageLifeProbeRequire: PageLifeProbeRequire.Head,
  },
  optionUI: {
    enable: {
      type: "switch",
      department: "common",
      description:"顶栏模糊",
      onActivate: () => {
        return true;
      },
      onDeactivate: () => {
        return false;
      },
    },
  },
};

export default module;
